/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.core.service.processor.edit;

import cn.hutool.core.util.ObjectUtil;
import info.peigen.hotpot.business.account.core.domain.account.Account;
import info.peigen.hotpot.business.account.core.domain.account.action.AccountConvertor;
import info.peigen.hotpot.business.account.core.service.processor.base.AbstractAccountServiceProcessor;
import info.peigen.hotpot.business.account.facade.result.edit.EditAccountResult;
import info.peigen.hotpot.common.service.base.processor.Processor;
import info.peigen.hotpot.common.service.base.processor.ProcessorServiceContext;
import org.noear.solon.annotation.Component;


/**
 * <b>(EditAccountResultProcessor)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/5/26
 */
@Component
public class EditAccountResultProcessor extends AbstractAccountServiceProcessor implements Processor {
    @Override
    public Integer level() {
        return 91;
    }

    @Override
    public void execute(ProcessorServiceContext serviceContext) {
        Account account = (Account) serviceContext.getDomain();
        if (ObjectUtil.isNotNull(account)) {
            EditAccountResult result = (EditAccountResult) serviceContext.getResult();
            result.fromSuccess(AccountConvertor.convertAccountInfo(account));
        }
    }

}
